package com.aaie.gru.theme.service.impl;

import com.aaie.gru.theme.entity.GruSysTheme;
import com.aaie.gru.theme.entity.GruSysThemeFeedback;
import com.aaie.gru.theme.mapper.GruSysThemeFeedbackMapper;
import com.aaie.gru.theme.mapper.GruSysThemeMapper;
import com.aaie.gru.theme.service.IGruSysThemeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.sql.Wrapper;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lvxing
 * @since 2019-08-09
 */
@Service
@Transactional
public class GruSysThemeServiceImpl extends ServiceImpl<GruSysThemeMapper, GruSysTheme> implements IGruSysThemeService {

    @Resource
    GruSysThemeMapper gruSysThemeMapper;

    @Resource
    GruSysThemeFeedbackMapper gruSysThemeFeedbackMapper;

    @Override
    public boolean delGruSysThemeById(String themeId) {
        gruSysThemeMapper.deleteById(themeId);
        QueryWrapper<GruSysThemeFeedback> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("theme_id", themeId);
        gruSysThemeFeedbackMapper.delete(queryWrapper);
        return true;
    }
}
